//
//  ShipuView.m
//  ThePrivateKitchen
//
//  Created by lirui on 16/1/20.
//  Copyright © 2016年 www.lanou3g.com蓝鸥科技. All rights reserved.
//

#import "ShipuView.h"

@implementation ShipuView

- (void)dealloc
{
    [_label1 release];
    [_label2 release];
    [_label3 release];
    [_label4 release];
    [_imgView1 release];
    [_imgView2 release];
    [_bofang release];
    [_bofang1 release];
    [super dealloc];
}

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/
-(instancetype)initWithFrame:(CGRect)frame
{
    self = [ super initWithFrame:frame];
    if ( self) {
        [self creatView];
    }
    return  self;
}
-(void)creatView
{  UITapGestureRecognizer *tap = [[ UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapAction:)];
    UITapGestureRecognizer *tap1= [[ UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapAction1:)];
    
    /**第一个图片*/
    self.imgView1 =[[ UIImageView alloc] initWithFrame:CGRectMake( WIDTH * 10, HEIGHT * 40, WIDTH *375 - 20,  HEIGHT*150)];
       [self addSubview:_imgView1];
    _imgView1.userInteractionEnabled = YES;
    [_imgView1 addGestureRecognizer:tap];
    [_imgView1 release];
    
    /**第二个图片*/
    self.imgView2 =[[ UIImageView alloc] initWithFrame:CGRectMake(WIDTH * 10, WIDTH * 50 +_imgView1.frame.size.height, _imgView1.frame.size.width, _imgView1.frame.size.height)];
        _imgView2.userInteractionEnabled = YES;
    [_imgView2 addGestureRecognizer:tap1];
    [self addSubview:_imgView2];
    [_imgView2 release];
    
    /**第一个图片的标题label*/
    self.label1 =[[ UILabel alloc] initWithFrame:CGRectMake(WIDTH * 10, HEIGHT* 100, self.imgView1.frame.size.width -20 * WIDTH, HEIGHT*30)];
       [self.imgView1 addSubview:_label1];
    _label1.textColor = [ UIColor whiteColor];
    [_label1 release];
    
    /**第一个图片的介绍label*/
    self.label2 =[[ UILabel alloc] initWithFrame:CGRectMake(WIDTH * 10, HEIGHT*130, self.imgView1.frame.size.width -20 * WIDTH, 20 * HEIGHT)];
    [self.imgView1 addSubview:_label2];
    _label2.textColor = [ UIColor whiteColor];
    _label2.font =[ UIFont systemFontOfSize:15];
    [_label2 release];
    
    /**第二个图片的标题label*/
    self.label3 =[[ UILabel alloc] initWithFrame:CGRectMake(WIDTH * 10, HEIGHT * 100, self.imgView1.frame.size.width -20 * WIDTH, 30 *HEIGHT)];
        [self.imgView2 addSubview:_label3];
    _label3.textColor = [ UIColor whiteColor];
    [_label3 release];
    
    /**第二个图片的介绍label*/
    self.label4 =[[ UILabel alloc] initWithFrame:CGRectMake(WIDTH * 10, HEIGHT*130, self.imgView1.frame.size.width -20 * WIDTH, 20 * HEIGHT)];
       [self.imgView2 addSubview:_label4];
    _label4.textColor = [ UIColor whiteColor];
    _label4.font =[ UIFont systemFontOfSize:15];
    [_label4 release];
    self.title =[[ UILabel alloc] initWithFrame:CGRectMake(WIDTH * 10,HEIGHT * 10, WIDTH * 280, 30*HEIGHT)];
    [self addSubview:_title];
    [_title release];
    /**第一图的播放按钮*/
    self.bofang = [[ UIImageView alloc] initWithFrame:CGRectMake(WIDTH * 375 /2 - 20*WIDTH,_imgView1.frame.size.height/2 - 20 *HEIGHT , WIDTH *40, HEIGHT *40)];
   _bofang.image = [UIImage imageNamed:@"iconfont-zhibo@2x"];
    [_imgView1 addSubview:_bofang];
 
 /**第二个图的播放按钮*/
    self.bofang1 = [[ UIImageView alloc] initWithFrame:CGRectMake(WIDTH * 375 /2 - 20*WIDTH,_imgView2.frame.size.height/2 - 20 *HEIGHT , WIDTH *40, HEIGHT *40)];
    _bofang1.image = [UIImage imageNamed:@"iconfont-zhibo@2x"];
    [_imgView2 addSubview:_bofang1];
    [_bofang1 release];
    [_bofang release];
}

#pragma mark -block传值
-(void)tapAction:(UITapGestureRecognizer *)tap
{
    self.blockimg1();
}
-(void)tapAction1:(UITapGestureRecognizer *)tap1
{
    self.blockimg2();
}
@end

